﻿(function () {
    nova.widgets.Logger = function (millisecond, showLog) {
        this.time = 5000;
        this.showLog = false;
        if (millisecond != null && (millisecond * 1) > 0) {
            this.time = millisecond;
        }
        if(showLog!=null) {
            this.showLog = showLog;
        }

    };

    nova.widgets.Logger.prototype.log = function (message) {
        if (this.showLog == false) {
            return;
        }
        var $ul = $('ul#log');
        if ($ul.length == 0) {
            $ul = $('<ul id="log"></ul>');
            $ul.appendTo('#layout');
        }
        var $li = $('<li>' + message + '</li>');
        $li.appendTo($ul);
        $li.click(function () {
            $li.remove();
        });
        setTimeout(function () {
            $li.remove();
        }, this.time);
    };
})();